<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//前台接口
Route::group(['namespace' => 'Api', 'prefix' => '/api'], function (){
    Route::post('/createOrUpdateUser', 'UserController@addOrUpdate');
    //收货地址
    Route::post('/addAddress', 'UserController@addAddress');
    Route::get('/addressList', 'UserController@addressList');
    Route::put('/updateAddress/{id}', 'UserController@updateAddress');
    Route::delete('/deleteAddress/{id}', 'UserController@deleteAddress');

    //商品分类
    Route::get('/productCategotyList', 'ProductCategoryController@index');

    //商品
    Route::get('/listWithCategoryId', 'ProductController@listWithCategoryId');
    Route::get('/productList', 'ProductController@index');
    Route::get('/productDetail/{id}', 'ProductController@detail');

    //店铺列表
    Route::get('/bistroList', 'BistroController@index');
    Route::get('/findBistroByQrcode', 'BistroController@findBistroByQrcode');


    Route::get('/positionList/{id}', 'PositionController@index');
    Route::get('/searchWithQrcode', 'PositionController@searchWithQrcode');

    //购物车
    Route::get('/getShoppingCart', 'ShoppingCartController@getShoppingCart');
    Route::post('/addShoppingCart', 'ShoppingCartController@addShoppingCart');
    Route::post('/addShoppingCartOneTime', 'ShoppingCartController@addShoppingCartOneTime');


    Route::delete('/deleteShoppingCart', 'ShoppingCartController@deleteShoppingCart');

    Route::post('/addShoppingCartByOthers', 'ShoppingCartController@addShoppingCartByOthers');
    //分享点餐的链接
    Route::post('/sharePage', 'ShoppingCartController@sharePage');
    Route::get('/getShoppingCartByOpenId', 'ShoppingCartController@getShoppingCartByOpenId');
//    Route::get('/getShoppongCartByOpenId', 'ShoppingCartController@getShoppongCartByOpenId');
    Route::post('/addShoppingCartByOpenid', 'ShoppingCartController@addShoppingCartByOpenid');

    //邀请别人添加购物车

    Route::post('/createDinner', 'ShoppingCartController@createDinner');
    Route::get('/nowDinner', 'BistroController@nowDinner');



    //订单
    Route::post('/addOrder', 'OrderController@addOrder');
    Route::get('/orderList', 'OrderController@index');


    //订单支付
    Route::any('/payOrder/{id}', 'OrderController@payOrder');
    Route::any('/payOrderCallBack', 'OrderController@payOrderCallBack');
});


/**
 * 上传图片
 */
Route::post('/uploadImage', 'Api\UploadController@storeImage');


Route::group(['namespace' => 'Backend', 'prefix' => '/backend'], function (){



    Route::post('/login', 'AuthController@login');
    Route::delete('/logout', 'AuthController@logout');

    Route::post('/createHeadStore', 'HeadStoreController@create');//->middleware('jwt')
    Route::get('/headStoreList', 'HeadStoreController@index')->middleware('jwt');
    Route::get('/headStoreInformation', 'AuthController@headStoreInformation')->middleware('jwt');

    Route::post('/createBistro', 'BistroController@create');
    Route::get('/bistroList', 'BistroController@index')->middleware('jwt');
    Route::get('/bistroDetail/{id}', 'BistroController@detail')->middleware('jwt');
    Route::get('/staticBistro/{id}', 'BistroController@staticBistro')->middleware('jwt');


    //分店管理的
    Route::post('/bistroLogin', 'AuthController@bistroLogin');
    Route::get('/bistroInformation', 'AuthController@bistroInformation')->middleware('jwtbistro');

    Route::get('/productList', 'ProductController@index')->middleware('jwtbistro');
    Route::post('/createProduct', 'ProductController@create')->middleware('jwtbistro');

    Route::get('/bistroStaticDay', 'BistroController@staticDay')->middleware('jwtbistro');
    Route::get('/bistroStaticMonth', 'BistroController@staticMonth')->middleware('jwtbistro');


    //商品分类
    Route::get('/productCateGoryList', 'ProductCategoryController@index')->middleware('jwtbistro');
    Route::post('/createProductCateGory', 'ProductCategoryController@create')->middleware('jwtbistro');
    Route::put('/productCategoryEdit/{id}', 'ProductCategoryController@update')->middleware('jwtbistro');
    Route::delete('/prodcutCategoryDelete/{id}', 'ProductCategoryController@delete')->middleware('jwtbistro');


    //商品
    Route::get('/productDetail/{id}', 'ProductController@detail')->middleware('jwtbistro');
    Route::put('/productEdit/{id}', 'ProductController@edit')->middleware('jwtbistro');
    Route::delete('/productDelete/{id}', 'ProductController@delete')->middleware('jwtbistro');

    Route::get('/staticProductDay', 'ProductController@staticProductDay')->middleware('jwtbistro');
    Route::get('/staticProductMonth', 'ProductController@staticProductMonth')->middleware('jwtbistro');
    Route::get('/staticCategoryDay', 'ProductCategoryController@staticCategoryDay')->middleware('jwtbistro');
    Route::get('/productCategoryDetail/{id}', 'ProductCategoryController@detail')->middleware('jwtbistro');
    Route::get('/categoryAll', 'ProductCategoryController@categoryAll')->middleware('jwtbistro');




    Route::get('/positionList', 'PositionController@index')->middleware('jwtbistro');
    Route::post('/createPosition', 'PositionController@create')->middleware('jwtbistro');
    Route::get('/positionDetail/{id}', 'PositionController@detail')->middleware('jwtbistro');
    Route::put('/positionEdit/{id}', 'PositionController@edit')->middleware('jwtbistro');
    Route::delete('/positionDelete/{id}', 'PositionController@delete')->middleware('jwtbistro');


    //订单
    Route::get('/orderAll', 'OrderController@orderAll')->middleware('jwtbistro');
    Route::get('/orderList', 'OrderController@index')->middleware('jwtbistro');
    Route::put('/updateOrderOrder/{id}', 'OrderController@updateOrderOrder')->middleware('jwtbistro');
    Route::put('/completeOrder/{id}', 'OrderController@completeOrder')->middleware('jwtbistro');



    Route::get('/orderDetail/{id}', 'OrderController@detail');
    Route::put('/serveOrderProduct/{id}', 'OrderController@serveOrderProduct');
    Route::delete('/deleteOrder/{id}', 'OrderController@deleteOrder');
    Route::delete('/returningVegetables/{id}', 'OrderController@returningVegetables')->middleware('jwtbistro');
    Route::post('/orderAddProduct/{id}', 'OrderController@orderAddProduct')->middleware('jwtbistro');//加菜


});


//Route::middleware('refresh.token')->group(['namespace' => 'Backend', 'prefix' => '/backend'], function($router) {
//    $router->post('createHeadStore','HeadStoreController@create');
//});
